package com.grom.action;

import java.util.List;
import java.util.Map;

import com.dispacher.context.ContextHolder;
import com.grom.po.Security;
import com.grom.service.SecurityService;

public class FrameAction {
	public void changeDepart() {
		String SYSID = ContextHolder.findInstance().getRequest()
				.getParameter("SYSID");
		if (SYSID == null || SYSID.trim().equals("")) {
			SYSID = "SYSMANAGE";
		}
		ContextHolder.setRequestAttribute("SYSID", SYSID);
		String userName = (String) ContextHolder.getCurSession().getAttribute(
				"USER");
		Security currentSecurity = SecurityService.instance
				.getSecurityByAction(SYSID);
		Map<Security, List<Security>> userSecuritys = SecurityService.instance.getAllSecurityByParentId(currentSecurity
				.getID());
		List<Security> rootModules = SecurityService.instance
				.getAllRootSecurityByUser(userName);
		ContextHolder.setRequestAttribute("rootModules", rootModules);
		ContextHolder.setRequestAttribute("userSecuritys", userSecuritys);
		ContextHolder.forward("/WEB-INF/jsp/frame.jsp");
	}
}
